#pragma once
/// Copyright 2012, Alex Averian, Yonan Research
/// Released under BSD Licence



#include "qcontrol.h"
#pragma warning( disable: 4800)

namespace micro
{
namespace gui
{



class QDateTimeSelector : public QControl
{
public:
    // Constructors
    QDateTimeSelector( HWND hWnd = NULL )
    {
        _window = hWnd;
    }
    virtual ~QDateTimeSelector();

    QDateTimeSelector & operator=( HWND hWnd )
    {
        _window = hWnd;
        return *this;
    }

    HWND Create( HWND hWndParent, RECT & rcPos, LPCTSTR szWindowName = NULL,
                 DWORD dwStyle = 0, DWORD dwExStyle = 0,
                 UINT nID = 0, LPVOID lpCreateParam = NULL )
    {
        return 0;//QControl::Create(GetWndClassName(), hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam);
    }
    HWND Create( HWND hWndParent, LPRECT lpRect = NULL, LPCTSTR szWindowName = NULL,
                 DWORD dwStyle = 0, DWORD dwExStyle = 0,
                 HMENU hMenu = NULL, LPVOID lpCreateParam = NULL )
    {
        return 0;//QControl::Create(GetWndClassName(), hWndParent, lpRect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam);
    }

    // Operations
    virtual  LPCTSTR GetWndClassName()
    {
        return DATETIMEPICK_CLASS;
    }

    bool SetFormat( LPTSTR lpszFormat )
    {
        ASSERT( IsWindow() );
        return ( bool )::SendMessage( _window, DTM_SETFORMAT, 0, ( LPARAM )lpszFormat );
    }
    COLORREF GetMonthCalColor( int nColorType ) const
    {
        ASSERT( IsWindow() );
        return ( COLORREF )::SendMessage( _window, DTM_GETMCCOLOR, nColorType, 0L );
    }
    COLORREF SetMonthCalColor( int nColorType, COLORREF clr )
    {
        ASSERT( IsWindow() );
        return ( COLORREF )::SendMessage( _window, DTM_SETMCCOLOR, nColorType, clr );
    }
#if (_WIN32_IE >= 0x0400)
    HFONT GetMonthCalFont() const
    {
        ASSERT( IsWindow() );
        return ( HFONT )::SendMessage( _window, DTM_GETMCFONT, 0, 0L );
    }
    void SetMonthCalFont( HFONT hFont, bool bRedraw = TRUE )
    {
        ASSERT( IsWindow() );
        ::SendMessage( _window, DTM_SETMCFONT, ( WPARAM )hFont, MAKELPARAM( bRedraw, 0 ) );
    }
#endif //(_WIN32_IE >= 0x0400)
    DWORD GetRange( LPSYSTEMTIME lpSysTimeArray ) const
    {
        ASSERT( IsWindow() );
        return ::SendMessage( _window, DTM_GETRANGE, 0, ( LPARAM )lpSysTimeArray );
    }
    bool SetRange( DWORD dwFlags, LPSYSTEMTIME lpSysTimeArray )
    {
        ASSERT( IsWindow() );
        return ( bool )::SendMessage( _window, DTM_SETRANGE, dwFlags, ( LPARAM )lpSysTimeArray );
    }
    DWORD GetSystemTime( LPSYSTEMTIME lpSysTime ) const
    {
        ASSERT( IsWindow() );
        return ::SendMessage( _window, DTM_GETSYSTEMTIME, 0, ( LPARAM )lpSysTime );
    }
    bool SetSystemTime( DWORD dwFlags, LPSYSTEMTIME lpSysTime )
    {
        ASSERT( IsWindow() );
        return ( bool )::SendMessage( _window, DTM_SETSYSTEMTIME, dwFlags, ( LPARAM )lpSysTime );
    }
    HWND GetMonthCal() const
    {
        ASSERT( IsWindow() );
        return ( HWND )::SendMessage( _window, DTM_GETMONTHCAL, 0, 0L );
    }
};

}
}